fork or thread?

fork or thread?

am 19.01.2010 14:11:19 von extern.Lars.Oeschey

Hi,

I'm trying to write a script within the VMware vSphere Perl SDK. The
script will backup some VMs where those have it defined in Vsphere.
Currently I have the problem, that I get a timeout on my authenticated
connect, and can't reconnect (I don't know why, and the VMWare forums
aren't helpful there). So I thought about authenticating, and then
forking or creating a thread that does something in the VSphere to keep
the authentication alive. My problem here is that I don't know how to
end the forked/threaded process, aber all backups in the parent process
are done. This is the first time I have to do forking/threading, I read
about both but still am unsure about how to communicate to the child
that it should exit it's infinite loop.
Is there any best practice or something I should read about and don't
know?

Lars
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: fork or thread?

am 19.01.2010 14:14:21 von Angelos Karageorgiou

This is a multi-part message in MIME format.
--------------070003050305090807040207
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 19/1/2010 3:11 ??, Oeschey, Lars (I/ET-83, extern) wrote:
> Hi,
>
> I'm trying to write a script within the VMware vSphere Perl SDK. The
> script will backup some VMs where those have it defined in Vsphere.
> Currently I have the problem, that I get a timeout on my authenticated
> connect, and can't reconnect (I don't know why, and the VMWare forums
> aren't helpful there). So I thought about authenticating, and then
> forking or creating a thread that does something in the VSphere to keep
> the authentication alive. My problem here is that I don't know how to
> end the forked/threaded process, aber all backups in the parent process
> are done. This is the first time I have to do forking/threading, I read
> about both but still am unsure about how to communicate to the child
> that it should exit it's infinite loop.
> Is there any best practice or something I should read about and don't
> know?
>
> Lars
> _______________________________________________

read the code here
http://github.com/book/HTTP-Proxy/blob/master/lib/HTTP/Proxy /Engine/Legacy.pm

It will enlighten you !
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLVbAtAAoJECIvZqD7XRsw0O8H/RTxP2nIxGOPNcQIYaKb +ECu
ZqSoX5AE3aPVnAcHtnpOJSTOqyKc2ltmtNpCSVoxfw3ozLBRqBt1lhDiTigm /GBj
3wrLqquaTbzBTLOm61OosS9leSMtDNykItUJjGeAn0qRqPQp/yY2vIq4lQzH EosS
aT2HF1aWB+JB6kYwDVzADymQfCcJ/btZknByFH1kktsttbrlxkhUaw8/zx9e 5x7C
1ghSslToXpsZltPf8DdKcafYtmvB4niES8oqe0qsa/tMooO/TN5TVFTn3iX4 xjek
TY7OFUczcN+5pe+qIMhKsPvNw9ohqLbUiloOab3akAacTAObYgHdukWM0Y/L QJI=
=rGsE
-----END PGP SIGNATURE-----

--------------070003050305090807040207
Content-Type: text/x-vcard; charset=utf-8;
name="angelos.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="angelos.vcf"

begin:vcard
fn:Angelos Karageorgiou
n:Karageorgiou;Angelos
org:Vivodi Telecommunications S.A. / On Telecoms
email;internet:angelos@unix.gr
title:Security Manager
tel;work:+30 211 7503 893
tel;fax:+30 211 7503 701
tel;cell:+30 6949120773
note;quoted-printable: =
=
Linkedin Profile =
=
http://www.linkedin.com/in/unixgr =
=
=
=
Personal Web Site =
http://www.unix.gr =
=
=
Blog Site =
http://angelos-proverbs.blogspot.com
x-mozilla-html:FALSE
url:http://www.linkedin.com/in/unixgr
version:2.1
end:vcard


--------------070003050305090807040207
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--------------070003050305090807040207--

RE: fork or thread?

am 19.01.2010 15:52:11 von Jeff Saxton

Authentication to VI times out after 30 minutes, you will need to get a new handle if your process takes (or can take) longer than that to complete.

________________________________________
From: activeperl-bounces@listserv.ActiveState.com [activeperl-bounces@listserv.ActiveState.com] On Behalf Of Oeschey, Lars (I/ET-83, extern) [extern.Lars.Oeschey@AUDI.DE]
Sent: Tuesday, January 19, 2010 7:11 AM
To: activeperl@listserv.activestate.com
Subject: fork or thread?

Hi,

I'm trying to write a script within the VMware vSphere Perl SDK. The
script will backup some VMs where those have it defined in Vsphere.
Currently I have the problem, that I get a timeout on my authenticated
connect, and can't reconnect (I don't know why, and the VMWare forums
aren't helpful there). So I thought about authenticating, and then
forking or creating a thread that does something in the VSphere to keep
the authentication alive. My problem here is that I don't know how to
end the forked/threaded process, aber all backups in the parent process
are done. This is the first time I have to do forking/threading, I read
about both but still am unsure about how to communicate to the child
that it should exit it's infinite loop.
Is there any best practice or something I should read about and don't
know?

Lars
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: fork or thread?

am 19.01.2010 18:00:52 von Jeff Saxton

--===============0516652135==
Content-Type: multipart/alternative;
boundary="_b1dc2c20-4a6b-473f-b296-cbcbdd7e9a94_"

--_b1dc2c20-4a6b-473f-b296-cbcbdd7e9a94_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


setup a signal handler in each child thread and make it return when you sen=
d a signal=2C or=2C if the child thread
knows when it's done you can just 'return' and it will become joinable.

Also as in my previous email remember that the connection to VI will timeou=
t after 30 minutes.

> Date: Tue=2C 19 Jan 2010 15:14:21 +0200
> From: angelos@unix.gr
> To: extern.Lars.Oeschey@AUDI.DE
> Subject: Re: fork or thread?
> CC: activeperl@listserv.activestate.com
>=20
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>=20
> On 19/1/2010 3:11 ??=2C Oeschey=2C Lars (I/ET-83=2C extern) wrote:
> > Hi=2C
> >=20
> > I'm trying to write a script within the VMware vSphere Perl SDK. The
> > script will backup some VMs where those have it defined in Vsphere.
> > Currently I have the problem=2C that I get a timeout on my authenticate=
d
> > connect=2C and can't reconnect (I don't know why=2C and the VMWare foru=
ms
> > aren't helpful there). So I thought about authenticating=2C and then
> > forking or creating a thread that does something in the VSphere to keep
> > the authentication alive. My problem here is that I don't know how to
> > end the forked/threaded process=2C aber all backups in the parent proce=
ss
> > are done. This is the first time I have to do forking/threading=2C I re=
ad
> > about both but still am unsure about how to communicate to the child
> > that it should exit it's infinite loop.
> > Is there any best practice or something I should read about and don't
> > know?
> >=20
> > Lars
> > _______________________________________________
>=20
> read the code here
> http://github.com/book/HTTP-Proxy/blob/master/lib/HTTP/Proxy /Engine/Legac=
y.pm
>=20
> It will enlighten you !
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>=20
> iQEcBAEBAgAGBQJLVbAtAAoJECIvZqD7XRsw0O8H/RTxP2nIxGOPNcQIYaKb +ECu
> ZqSoX5AE3aPVnAcHtnpOJSTOqyKc2ltmtNpCSVoxfw3ozLBRqBt1lhDiTigm /GBj
> 3wrLqquaTbzBTLOm61OosS9leSMtDNykItUJjGeAn0qRqPQp/yY2vIq4lQzH EosS
> aT2HF1aWB+JB6kYwDVzADymQfCcJ/btZknByFH1kktsttbrlxkhUaw8/zx9e 5x7C
> 1ghSslToXpsZltPf8DdKcafYtmvB4niES8oqe0qsa/tMooO/TN5TVFTn3iX4 xjek
> TY7OFUczcN+5pe+qIMhKsPvNw9ohqLbUiloOab3akAacTAObYgHdukWM0Y/L QJI=3D
> =3DrGsE
> -----END PGP SIGNATURE-----
=20
____________________________________________________________ _____
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/196390710/direct/01/=

--_b1dc2c20-4a6b-473f-b296-cbcbdd7e9a94_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable






setup a signal handler in each child thread and make it return when you sen=
d a signal=2C or=2C if the child thread
knows when it's done you can jus=
t 'return' and it will become joinable.

Also as in my previous email=
remember that the connection to VI will timeout after 30 minutes.

&=
gt=3B Date: Tue=2C 19 Jan 2010 15:14:21 +0200
>=3B From: angelos@unix.=
gr
>=3B To: extern.Lars.Oeschey@AUDI.DE
>=3B Subject: Re: fork or=
thread?
>=3B CC: activeperl@listserv.activestate.com
>=3B
&g=
t=3B -----BEGIN PGP SIGNED MESSAGE-----
>=3B Hash: SHA1
>=3B
=
>=3B On 19/1/2010 3:11 ??=2C Oeschey=2C Lars (I/ET-83=2C extern) wrote: r>>=3B >=3B Hi=2C
>=3B >=3B
>=3B >=3B I'm trying to writ=
e a script within the VMware vSphere Perl SDK. The
>=3B >=3B script =
will backup some VMs where those have it defined in Vsphere.
>=3B >=
=3B Currently I have the problem=2C that I get a timeout on my authenticate=
d
>=3B >=3B connect=2C and can't reconnect (I don't know why=2C and =
the VMWare forums
>=3B >=3B aren't helpful there). So I thought abou=
t authenticating=2C and then
>=3B >=3B forking or creating a thread =
that does something in the VSphere to keep
>=3B >=3B the authenticat=
ion alive. My problem here is that I don't know how to
>=3B >=3B end=
the forked/threaded process=2C aber all backups in the parent process
&=
gt=3B >=3B are done. This is the first time I have to do forking/threadin=
g=2C I read
>=3B >=3B about both but still am unsure about how to co=
mmunicate to the child
>=3B >=3B that it should exit it's infinite l=
oop.
>=3B >=3B Is there any best practice or something I should read=
about and don't
>=3B >=3B know?
>=3B >=3B
>=3B >=3B =
Lars
>=3B >=3B _______________________________________________
&g=
t=3B
>=3B read the code here
>=3B http://github.com/book/HTTP-Pr=
oxy/blob/master/lib/HTTP/Proxy/Engine/Legacy.pm
>=3B
>=3B It wil=
l enlighten you !
>=3B -----BEGIN PGP SIGNATURE-----
>=3B Version=
: GnuPG v1.4.9 (MingW32)
>=3B Comment: Using GnuPG with Mozilla - http=
://enigmail.mozdev.org/
>=3B
>=3B iQEcBAEBAgAGBQJLVbAtAAoJECIvZq=
D7XRsw0O8H/RTxP2nIxGOPNcQIYaKb+ECu
>=3B ZqSoX5AE3aPVnAcHtnpOJSTOqyKc2l=
tmtNpCSVoxfw3ozLBRqBt1lhDiTigm/GBj
>=3B 3wrLqquaTbzBTLOm61OosS9leSMtDN=
ykItUJjGeAn0qRqPQp/yY2vIq4lQzHEosS
>=3B aT2HF1aWB+JB6kYwDVzADymQfCcJ/b=
tZknByFH1kktsttbrlxkhUaw8/zx9e5x7C
>=3B 1ghSslToXpsZltPf8DdKcafYtmvB4n=
iES8oqe0qsa/tMooO/TN5TVFTn3iX4xjek
>=3B TY7OFUczcN+5pe+qIMhKsPvNw9ohqL=
bUiloOab3akAacTAObYgHdukWM0Y/LQJI=3D
>=3B =3DrGsE
>=3B -----END P=
GP SIGNATURE-----


Hotmail: Powerful Free email w=
ith security by Microsoft. /direct/01/' target=3D'_new'>Get it now.
=

--_b1dc2c20-4a6b-473f-b296-cbcbdd7e9a94_--

--===============0516652135==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0516652135==--